const { defineConfig } = require('@vue/cli-service')
const webpack = require('webpack')

const path = require('path');
function resolve(dir) {
  return path.join(__dirname, dir);
}
module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: "./",
  chainWebpack: config => {
    config.resolve.alias.set("@", resolve("src"));
    config.plugin('provide').use(webpack.ProvidePlugin, [{
      $: 'jquery',
      jquery: 'jquery',
      jQuery: 'jquery',
      'window.jQuery': 'jquery'
    }])
  },
  devServer: {
    port: 9988,
    open: false,
    proxy: {
      [process.env.VUE_APP_BASE_API]: { // /dev-api
        target: 'http://api.jinshi.zhongsheyun.com', // 这个你们自己去fastmock弄啦.
        changeOrigin: true, // 开启代理服务器.
        pathRewrite: {
          [`^${process.env.VUE_APP_BASE_API}`]: '',
        }
      }
    }
  },
})
